<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8">
    <title>结巴切词</title>

    <script language="javascript">
        function segment(){
            var xhr = new XMLHttpRequest();
            xhr.open('POST', '/segment/');
            xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            xhr.send("keywords=" + document.getElementById("keywords").value+"&type="+document.getElementById("type").value);
            xhr.timeout = 5000;
            xhr.ontimeout = function(event){
                alert('timeout!');
            }
            xhr.onreadystatechange = function(){
        　　　　if ( xhr.readyState == 4 && xhr.status == 200 ) {
                    document.getElementById("segment").value = xhr.responseText;
        　　　　}
        　　};
        }
    </script>
</head>

<body>
<p><select id="type">
    <option value="TAGGING" selected="selected">词性标注</option>
    <option value="KEYWORD">关键词抽取</option>
    <option value="1">最大概率法(MP)</option>
    <option value="2">隐式马尔科夫模型(HMM)</option>
    <option value="3">混合模型(Mix)</option>
    <option value="4">FullSegment</option>
    <option value="5">索引模型(Query)</option>
</select>
</p>
<p><textarea rows="10" cols="50" id="keywords"></textarea> <textarea rows="10" cols="50" id="segment"></textarea></p>
<input type="submit" onclick="segment();" value="分词"/>

<div style="margin-top:50px;">
    <p>Full方法切出所有字典里的词语。</p>
    <p>Query方法先使用Mix方法切词，对于切出来的较长的词再使用Full方法。</p>
</div>
</body>
</html>
